/*
 * Copyright 2010 WANdisco, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package com.googlecode.svnj.setuid;

public class Setuid {

    public static native void setID(String username, String groupname);
    
    public static native String getGroup();

    public static native String getUser();
    
    static {
        System.loadLibrary("wdsetuid");
    }
    public static void main(String[] a) throws Exception {
        String u = getUser();
        String g = getGroup();
        System.out.println("current user/group: " + u + "/" + g);
        Setuid sample = new Setuid();
        callbackTest(sample);
         setID("www-data", "www-data");
    }

    private static native void callbackTest(Setuid s);
    
    private void callMeBack() {
        p("got called back, instance");
    }
    private static void callMeBack_static() {
        p("got called back, static");
    }
    private static void p(String s) {
        System.out.println("[Setuid] " + s);
    }
}
